Package com.fsf.news.service
Class NewsSourcesServiceTest
java.lang.Object
com.fsf.news.service.NewsSourcesServiceTest
@ExtendWith(org.mockito.junit.jupiter.MockitoExtension.class)
class NewsSourcesServiceTest
extends Object
Unit tests for the NewsSourcesService class.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) com.fsf.news.client.NewsApiClient(package private) com.fsf.news.processor.NewsFleschMetricsProcessor(package private) com.fsf.news.model.form.NewsSourcesForm(package private) play.twirl.api.Html(package private) com.fasterxml.jackson.databind.JsonNode(package private) com.fsf.news.renderer.NewsRenderer(package private) com.fsf.news.processor.NewsResponseProcessor(package private) com.fsf.news.repository.NewsSourcesRepository(package private) com.fsf.news.service.NewsSourcesService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidTests that the addSourcesResult method adds a sources result and returns the expected result.(package private) voidTests that the addSourcesResult method does not add a sources result that has no sources.(package private) voidTests that the addSourcesResult method throws an exception when no session ID is provided.(package private) voidTests that the getSourceProfile method returns the expected result.(package private) voidTests that the getSourcesResults method returns the expected results.(package private) voidTests that the getSourcesResults method throws an exception when no session ID is provided.
-
Field Details
-
sourcesService
@InjectMocks com.fsf.news.service.NewsSourcesService sourcesService -
apiClient
@Mock com.fsf.news.client.NewsApiClient apiClient -
responseProcessor
@Mock com.fsf.news.processor.NewsResponseProcessor responseProcessor -
fleschMetricsProcessor
@Mock com.fsf.news.processor.NewsFleschMetricsProcessor fleschMetricsProcessor -
renderer
@Mock com.fsf.news.renderer.NewsRenderer renderer -
sourcesRepository
@Mock com.fsf.news.repository.NewsSourcesRepository sourcesRepository -
form
@Mock com.fsf.news.model.form.NewsSourcesForm form -
jsonNode
@Mock com.fasterxml.jackson.databind.JsonNode jsonNode -
html
@Mock play.twirl.api.Html html
-
-
Constructor Details
-
NewsSourcesServiceTest
NewsSourcesServiceTest()
-
-
Method Details
-
testGetSourcesResults
@Test void testGetSourcesResults()Tests that the getSourcesResults method returns the expected results. -
testGetSourcesResultsException
@Test void testGetSourcesResultsException()Tests that the getSourcesResults method throws an exception when no session ID is provided. -
testAddSourcesResult
@Test void testAddSourcesResult()Tests that the addSourcesResult method adds a sources result and returns the expected result. -
testAddSourcesResultEmpty
@Test void testAddSourcesResultEmpty()Tests that the addSourcesResult method does not add a sources result that has no sources. -
testAddSourcesResultException
@Test void testAddSourcesResultException()Tests that the addSourcesResult method throws an exception when no session ID is provided. -
testGetSourceProfile
@Test void testGetSourceProfile()Tests that the getSourceProfile method returns the expected result.
-